home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
disk
/
lfnsrt12.zip
/
LFNSORT.TXT
< prev
Wrap
Text File
|
1996-07-07
|
19KB
|
437 lines
LFNSORT v 1.2 - Sorts DOS/Win95 directories
Copyright (c) 1995,1996 D.J. Murdoch.
0. Contents of this file
1. Syntax
2. Description
3. Details
4. Memory Limitations
5. Safety
6. License
7. Release History
8. Known bugs
9. Acknowledgments
1. Syntax:
LFNSORT sortkeys [dirname] [options]
will sort the directory records on disk according to the
specified sort keys.
Keys:
N - full filename
E - extension
D - last modification date
T - last modification time
C - creation date/time
A - last access date/time
S - size
Place a "-" minus sign in front of a key to sort in descending
order instead of ascending order. Keys can be combined, e.g.
"-DN" for "sorted by descending modification date, and by
ascending name within date". Use "-" by itself as a placeholder
if you want no sort key.
Options:
/8 base sort order on 8.3 version of names instead of long
names
/C case sensitive sort - ascii sort order
/D mix directories in with files
/Debug file write debug information to file
/F filename read forced sort order from file (see below for
syntax and examples
/NW no write - changes won't be saved to disk
/S sort subdirectories recursively
/System don't sort system files first in the root dir
/V verbose mode; list all directories and filenames after
sorting
Examples:
To sort every subdirectory on drive C: by file extension then
filename:
LFNSORT en c:\ /s
To sort every directory on drive C: so that most recently
accessed files come first:
LFNSORT -a-d-t c:\ /s
(The "-d-t" is necessary because not all directory records
include an access time; older ones and ones created in DOS mode
will only have a modification time.)
2. Description:
The original Norton Utilities had a program called DS which
could sort your DOS directories according to your preferences.
Later versions added a graphical interface so you could manually
move files around.
When Win95 came out with the VFAT long filenames, DS stopped
working. It hadn't been written to handle the new directory
records. Symantec (the current owners of the Norton Utilities)
haven't produced a new version of DS as far as I know, so when
Jacques Bensimon suggested that a minor modification to my
long filename backup utility DOSLFNBK could do directory sorts,
I decided that I wanted DS badly enough to write it myself.
There is already at least one freeware/shareware utility called
DIRSORT, so I called mine LFNSORT.
3. Details:
Disk locking:
LFNSORT works on the disk drive at a pretty low level. To be
allowed this access, it requests exclusive access to the drive
from Windows. If another program has already requested
exclusive access, LFNSORT will exit and do nothing. While
LFNSORT is running, other programs will not be allowed to write
to the disk or to create new files. This may confuse them; it's
probably best not to attempt any other disk activity in the
middle of an LFNSORT run. (LFNSORT has been written according to
Microsoft's instructions to work without damaging your disk even
if another program attempts access, but the other program might
not be.)
LFNSORT handles the disk locking itself. In fact, if you use
the LOCK command to lock the drive, LFNSORT will be unable to
obtain a lock, and will not run.
If you run LFNSORT under DOS, or in a version of Windows that
doesn't support drive locking, it will still run. If it detects
Windows it will warn you that running in a multitasker without
protecting the disk from changes is dangerous, and will only
go ahead if you confirm you really mean it. If it doesn't detect
Windows, it will assume that it is safe to go ahead --- so if
you're using another multitasker like Desqview, use it with
extreme care!
Forcing a particular order:
The /F option takes a plain ascii file as an argument. This
file should have the following format:
\directory1
firstfile
secondfile
thirdfile
\directory2
afile
bfile
cfile
Specifically: any line with a backslash "\" in it is taken as a
directory name, any other non-blank line is taken as a filename.
These will force the files in directory1 and directory2 into the
order given. If a file isn't listed, it will normally appear
*after* all the listed files. However, you can override this by
putting a "*" entry in place of a file; then all unlisted files
will be placed there. For example,
\directory
firstfile
*
lastfile
will guarantee the placement of those two files, but sort
everything else according to the specified sort keys. (Hint:
if you want to use the file to specify part of the order but
make no other changes, use "-" as a sort key.)
The order in which the directory sections appear in this file is
ignored. If you want directories in a particular order, list
them in a section for their parent directory. If you don't
specify any directory name, the ordering is used as a default
for unlisted directories. For example, to put README.1ST
files first in every directory where they exist, put a single
line containing "README.1ST" into a file called FORCED.LST, and
run
LFNSORT - c:\ /f forced.lst
File and directory names in this file may normally be either 8.3
aliases or long filenames, but if you're running outside Windows
where there is no long filename support, you *must* use the 8.3
alias.
If you want to force the file order for a large collection of
directories, you can use the /V option to create a preliminary
version of the forcing file. For example,
LFNSORT - c:\ /D/System/NW/S/V >new.lst
will write a list of the files in their current order
into the "new.lst" file. The - specifies no sorting, and the
/D and /System options turn off the default actions for
directories and system files.
Moving system files:
Normally the root directory of your boot drive has IO.SYS first,
and MSDOS.SYS in the second place. As long as these are left
with the System and Hidden attributes set, LFNSORT won't move
them. However, if you accidentally move them and want to
restore them to the start of the directory (because some
versions of DOS won't boot if they get moved):
Put these two lines in a file called FORCED.LST:
IO.SYS
MSDOS.SYS
and run
LFNSORT - c:\ /F forced.lst /System /D
Volume labels:
Pre-7.0 versions of DOS can be confused by long filename
records, which look to them like volume labels. This can be
fixed by putting the volume label before any long filenames in
the directory, but the Win95 LABEL command doesn't do this.
LFNSORT fixes this, unless you use the /System option, in which
case the volume label will be sorted like a file record. Don't
put the volume label ahead of your boot files, if you want your
disk to be bootable.
Example: If you want to put the volume label "BIG DRIVE" just
after IO.SYS and MSDOS.SYS, set FOR